package com.cy.pj.sys.dao;

import com.cy.pj.sys.pojo.SysNotice;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.sql.SQLException;
import java.util.List;

@SpringBootTest
public class NoticeDaoTests1 {
    @Autowired
    private SysNoticeDaoTest sysNoticeDaoTest;

    @Test
    void selectNoticeTest() throws SQLException {
        List<SysNotice> list  =  sysNoticeDaoTest.selectNotices(2l);
        System.out.println(list);
    }

    @Test
    void insertNoticeTest(){
        SysNotice notice = new SysNotice();
        notice.setTitle("CGB2013 结课时间");
        notice.setContent("2021/7/20 正式结课");
        notice.setStatus("0");
        notice.setType("1");
        notice.setCreatedUser("tony");
        notice.setModifiedUser("tony");

        int i = sysNoticeDaoTest.insertNotice(notice);
        System.out.println(i);
    }



    @Test
    void updateNoticeTest(){
        SysNotice notice = new SysNotice();
        notice.setTitle("CGB2013 牛");
        notice.setType("3");
        notice.setId(4L);
        int i = sysNoticeDaoTest.updateNotice(notice);
        System.out.println(i);
    }


    @Test
    void selectNoticeList(){
        Long[] l = {6l,5l,7l};
        int i = sysNoticeDaoTest.deleteNoticeList(l);
        System.out.println(i);
    }

    @Test
    void selectAnno(){

       SysNotice sysNotice =  sysNoticeDaoTest.selectAnno(1L);
        System.out.println(sysNotice);
    }


    @Test
    void selectWhere(){
        SysNotice sysNotice = new SysNotice();
        sysNotice.setId(1L);
        List<SysNotice> list = sysNoticeDaoTest.selectWhere(sysNotice);
        System.out.println(list);
    }
}
